<?php
include_once(NUKE_BASE_DIR.'header.php');
include_once("modules/".$module_name."/menu.php");
OpenTable();
global $userinfo, $module_name, $db, $userinfo;
$canupload = 0;
if ($userinfo['user_id'] != 1) {
	$username = $userinfo['username'];
    $usergroup = $db->sql_query("SELECT * FROM " . $prefix . "_bbuser_group WHERE user_id='".$userinfo['user_id']."'");
	while($usergroupcheck = $db->sql_fetchrow($usergroup))
    {
		$user_allowed = $db->sql_ufetchrow("SELECT group_single_user, img_allow FROM ".$prefix."_bbgroups WHERE group_id='".$usergroupcheck['group_id']."'");  
        if($user_allowed['group_single_user'] == 0 && $user_allowed['img_allow'] == 1)
        {
            $canupload = $user_allowed['img_allow'];
        }
    }
}
if($canupload != 1)
{
    echo _NOTALLOWEDUPLOAD;
}
else{ 
	$result1 = $db->sql_query("SELECT * FROM `". $prefix ."_upload` WHERE id='".$userinfo['user_id']."'"); 
	$numrows = $db->sql_numrows($result1);
	$maxuploads = $config['maxuploads'];
	include_once("modules/".$module_name."/menu.php");
	if($numrows == $maxuploads)
	{
		echo "<center>"._MAXUPLOADS." ".$maxuploads."</center>";
	}
	else
	{
		echo"
		<table width=\"500\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\">
			<tr>
			<form action=\"modules.php?name=Upload&amp;op=uploadimage\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\" id=\"form1\">
			<td>
				<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">
					<tr>
						<td>
						<input name=\"sender_name\" type=\"hidden\" value=".$userinfo['username']." />
							"._MAXUPLOADIS." ".$maxuploads."<br /><br />
							"._USERNAME." <b>".$userinfo['username']."</b><br/>
							
					</td>
					</tr>
					<tr>
						<td>"._SELECTFILE."
						<input style=\"color: black;\" name=\"file\" type=\"file\" id=\"file\" size=\"50\" value=\"Upload...\" /></td>
					</tr>
					<tr>
						<td align=\"center\"><input type=\"submit\" name=\"Submit\" value=\""._UPLOAD."\" /></td>
					</tr></table>
			</td>
			</form>
			</tr>
		</table>
		";
	}
}
	CloseTable();
	include_once(NUKE_BASE_DIR.'footer.php');
?>